package com.house.mapper;

import com.house.entity.House;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.SelectKey;

import java.util.List;

@Mapper
public interface HouseMapper {
    int deleteByPrimaryKey(Integer id);

    @SelectKey(keyProperty = "id",keyColumn = "id",before = false,resultType = Integer.class,statement = "select last_insert_id()")
    int insert(House record);

    int insertSelective(House record);

    House selectByPrimaryKey(Integer id);
    int countbyArea(String area);
    int updateByPrimaryKeySelective(House record);

    int updateByPrimaryKeyWithBLOBs(House record);

    int updateByPrimaryKey(House record);
    List<House> findAll();
    List<House> findAllRelease();
    List<House> findAllUnRelease();
    List<House> findByPay(@Param("pay")String pay);
    List<House> findBy(@Param("paytype")String paytype,@Param("type")String type,@Param("area")String area);
    List<House> findByOrder(@Param("paytype")String paytype,@Param("type")String type,@Param("area")String area,@Param("order")String order);

    List<House> findAllByStatus(@Param("status")int status);
    int updateStatusByIdAndStatus(@Param("id")int id,@Param("status")int status);

    List<House> findAllByUserId(@Param("userId")int userId);

}